package com.pactera.asmp.server.common.threadpool.workqueue;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * <p>Class: com.lzq.plugin.threadpool.workqueue.WrokThreadFactory</p>
 * <p>Description: </p>
 * <pre>
 *
 * </pre>
 *
 * @author lv zhiqiang
 * @date 2019/7/17/12:04
 */
public class WrokThreadFactory implements ThreadFactory {
    private static final Logger logger = LoggerFactory.getLogger(WrokThreadFactory.class);
    private final AtomicInteger mThreadNum = new AtomicInteger(1);

    @Override
    public Thread newThread(Runnable r) {
        Thread thread = new Thread(r, "core-thread-" + mThreadNum.getAndIncrement());
        logger.info(thread.getName() + " has been created");
        return thread;
    }
}
